The routine that sets up the lighting and shading environment is:
gSetShadingMode(mode, [gCulling, gBlending, gWinding])which also sets up other lighting parameters as described below.
By default shading is switched off, under which circumstances objects are displayed in their defined colour, ignoring any lights and not sorted according to their distance from the viewer. Therefore new objects will hide objects already on the display if they occupy the same space.
When shading is switched on, objects further away from the viewer are automatically hidden from those closer. This is also known as depth buffering (see below) in which data is only placed on the output device if it represents an object which is closer to the view point than the data already displayed at that point. At the same time, the correct colour of the object is calculated using the current lighting and the objects material properties.
This shading can be performed in a number of different ways, requiring different amount of processing, and giving different levels of realism.
To take full advantage of lighting and shading facilities, it is advisable to use the facet primitive, as these primitives contain all the necessary material attributes to calculate their correct appearance under different lighting conditions (see Facets).
One of the features of a facet is that it has a front and back face which allows different material properties to be defined for the inside and the outside of objects using a single 'skin'. However, it is obviously more expensive, in computing terms, to calculate the lighting values on both sides of every facet. It is possible therefore to save time by ignoring either all of the front or all of the back facing facets using the optional argument gCulling to the gSetShadingMode() routine.
This feature is useful if the scene is composed of solid objects and you are never interested in the inside or back of these objects.
Where any of the 3D objects in a scene are required to be transparent, using the appropriate material property, it is necessary to enable an additional shading function called blending. This adds another level of complexity to the lighting calculation as the colours of existing pixels need to be multiplied by the new objects colour to obtain the correct values. This feature is switched on using the optional argument gBlending to gSetShadingMode().  To achieve the correct transparency effect, make sure that fully opaque primitives are rendered first, followed by partially opaque primitives in back-front order.
By default, GINO interprets the coordinates of facets and polygons such that vertices defined in an anti-clockwise order are understood to be facing the viewer. Conversely, where vertices are defined as being in an anti-clockwise order as seen from the current viewing point, the surface is interpreted as facing away from the viewer. This is known as the facet winding and can be reversed using the optional argument gWinding argument where an application requires its vertices to be interpreted in the opposite way.
The current lighting and shading settings may be enquired using the routine:
gEnqShadingMode(att)where att is a structure of type GSHADING which contains the four aspects of the lighting and shading environment.